package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.CriterionEvaluationShowDao;
import cn.topevery.garden.entity.po.CriterionDef;
import cn.topevery.garden.entity.po.CriterionEvaluationShow;
import cn.topevery.garden.entity.query.CriterionEvaluationShowQuery;
import cn.topevery.garden.entity.vo.CriterionEvaluationShowVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 
 *
 * @author code-generate
 * @date 2022-01-05
 */
@Service
public class CriterionEvaluationShowLogic extends BaseLogic<CriterionEvaluationShow> {
    @Autowired
    CriterionEvaluationShowDao criterionEvaluationShowDao;

    @Override
    public BaseEntityDao<CriterionEvaluationShow, Integer> getDao() {
        return criterionEvaluationShowDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<CriterionEvaluationShowVO> listPage(CriterionEvaluationShowQuery query) {
        return criterionEvaluationShowDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        criterionEvaluationShowDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param criterionEvaluationShow 实体
     */
    public void saveOrUpdate(String userId, CriterionEvaluationShow criterionEvaluationShow){
        criterionEvaluationShowDao.saveOrUpdate(userId,criterionEvaluationShow);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public CriterionEvaluationShow getEntityByColumn(String key, String value) {
        return criterionEvaluationShowDao.getEntityByColumn(key, value);
    }


    public List<CriterionEvaluationShow> getRelationListByCriterionIdAndMapId(List<CriterionDef> criterionList, String mapId){
        return criterionEvaluationShowDao.getRelationListByCriterionIdAndMapId(criterionList,mapId);
    }

    public void evaluation(List<CriterionEvaluationShow> evaluationList, Integer userId){
         criterionEvaluationShowDao.evaluation(evaluationList,userId);
    }

    public void yearForNewData(){
         criterionEvaluationShowDao.yearForNewData();
    }

    public CriterionEvaluationShow getByCriterionIdAndMapId(String criterionId, String mapId) {
        return criterionEvaluationShowDao.getByCriterionIdAndMapId(criterionId, mapId);
    }

    public List<CriterionEvaluationShow> getListByCriterionId(String criterionId) {
        return criterionEvaluationShowDao.getListByCriterionId(criterionId);
    }

    public void updateCountWhenPartakeChange(String criterionId, Integer flag) {
        criterionEvaluationShowDao.updateCountWhenPartakeChange(criterionId, flag);
    }
}
